package com.zc.study.thread.多线程第七章节.SolveTwo;

import com.zc.study.thread.多线程第七章节.SolveOne.DateUtils;

import java.text.ParseException;
import java.text.SimpleDateFormat;
import java.util.Date;

public class ThreadA extends Thread {
    private String dateString;
    private SimpleDateFormat sdf;
    public ThreadA(SimpleDateFormat sdf, String dateString) {
        this.sdf = sdf;
        this.dateString = dateString;
    }

    @Override
    public void run() {
        super.run();
        try {
            Date datesf = DateTools.getSimpleDateFormat("yyyy-MM-dd").parse(dateString);
            String dateNewString = DateTools.getSimpleDateFormat("yyyy-MM-dd").format(datesf);
            if(!dateNewString.equals(dateString)){
                System.out.println("treadName"+this.getName()+"报错了 日期字符串:"+dateString  +"转换成的日期为:"+ dateNewString);
            }
        } catch (ParseException e) {
            e.printStackTrace();
        }

    }
}
